<template>
  <div style="padding: 20px">
    <el-tabs type="border-card">
      <el-tab-pane label="职位置顶">
        <el-table :data="listTop" style="width: 100%">
          <el-table-column prop="name" label="名称" width="width">
          </el-table-column>
          <el-table-column prop="days" label="服务时长" width="width">
            <template slot-scope="scope"> {{ scope.row.days }}天 </template>
          </el-table-column>
          <el-table-column prop="prop" label="服务价格" width="width">
            <template slot-scope="scope"> ￥ {{ scope.row.expense }} </template>
          </el-table-column>
          <el-table-column prop="prop" label="积分抵扣" width="width">
            <template> 允许全额兑换 </template>
          </el-table-column>
          <el-table-column prop="prop" label="显示状态" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.is_display ? 'success' : 'danger'">{{
                scope.row.is_display ? "显示" : "隐藏"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="prop" label="推荐" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.recommend ? 'success' : 'danger'">{{
                scope.row.recommend ? "是" : "否"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="sort_id" label="排序" width="width">
          </el-table-column>
          <el-table-column prop="prop" label="操作" width="width">
            <template>
              <el-button
                type="primary"
                size="small"
                @click="editServerDialog = true"
                >编辑</el-button
              >
              <el-button type="danger" size="small" @click="delBtnTop"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <el-button
          type="primary"
          style="margin-top: 20px"
          size="mini"
          @click="addServerDialog = true"
          >添加</el-button
        >
      </el-tab-pane>
      <el-tab-pane label="职位紧急">
        <el-table :data="listEmergency" style="width: 100%">
          <el-table-column prop="name" label="名称" width="width">
          </el-table-column>
          <el-table-column prop="prop" label="服务时长" width="width">
            <template slot-scope="scope"> {{ scope.row.days }}天 </template>
          </el-table-column>
          <el-table-column prop="prop" label="服务价格" width="width">
            <template slot-scope="scope">
              ￥ {{ scope.row.deduct_max }}
            </template>
          </el-table-column>
          <el-table-column prop="prop" label="积分抵扣" width="width">
            <template>允许全额兑换</template>
          </el-table-column>
          <el-table-column prop="prop" label="显示状态" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.is_display ? 'success' : 'danger'">{{
                scope.row.is_display ? "显示" : "隐藏"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="prop" label="推荐" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.recommend ? 'success' : 'danger'">{{
                scope.row.recommend ? "是" : "否"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="sort_id" label="排序" width="width">
          </el-table-column>
          <el-table-column prop="prop" label="操作" width="width">
            <template>
              <el-button
                type="primary"
                size="small"
                @click="editServerJjDialog = true"
                >编辑</el-button
              >
              <el-button type="danger" size="small" @click="delBtnEmergency"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <el-button
          type="primary"
          style="margin-top: 20px"
          size="mini"
          @click="addServerJjDialog = true"
          >添加</el-button
        >
      </el-tab-pane>
      <el-tab-pane label="职位智能刷新">
        <el-table :data="listRefresh" style="width: 100%">
          <el-table-column prop="name" label="名称" width="width">
          </el-table-column>
          <el-table-column prop="prop" label="服务时长" width="width">
            <template slot-scope="scope"> {{ scope.row.times }}次 </template>
          </el-table-column>
          <el-table-column prop="prop" label="服务价格" width="width">
            <template slot-scope="scope"> ￥ {{ scope.row.expense }} </template>
          </el-table-column>
          <el-table-column prop="prop" label="积分抵扣" width="width">
            <template>允许全额兑换</template>
          </el-table-column>
          <el-table-column prop="prop" label="显示状态" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.is_display ? 'success' : 'danger'">{{
                scope.row.is_display ? "显示" : "隐藏"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="prop" label="推荐" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.recommend ? '是' : '否'">{{
                scope.row.recommend ? "是" : "否"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="sort_id" label="排序" width="width">
          </el-table-column>
          <el-table-column prop="prop" label="操作" width="width">
            <template>
              <el-button
                type="primary"
                size="small"
                @click="editServerZnDialog = true"
                >编辑</el-button
              >
              <el-button type="danger" size="small" @click="delBtnRefresh"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <el-button
          type="primary"
          style="margin-top: 20px"
          size="mini"
          @click="addServerZnDialog = true"
          >添加</el-button
        >
      </el-tab-pane>
      <el-tab-pane label="简历增值包">
        <el-table :data="listAdded" style="width: 100%">
          <el-table-column prop="name" label="名称" width="width">
          </el-table-column>
          <el-table-column
            prop="download_resume_point"
            label="简历下载点"
            width="width"
          >
            <template slot-scope="scope">
              {{ scope.row.download_resume_point }}点
            </template>
          </el-table-column>
          <el-table-column prop="expense" label="服务价格" width="width">
            <template slot-scope="scope"> ￥ {{ scope.row.expense }} </template>
          </el-table-column>
          <el-table-column prop="prop" label="积分抵扣" width="width">
            <template>允许全额兑换</template>
          </el-table-column>
          <el-table-column prop="prop" label="显示状态" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.is_display ? 'success' : 'danger'">{{
                scope.row.is_display ? "显示" : "隐藏"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="prop" label="推荐" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.recommend ? 'success' : 'danger'">{{
                scope.row.recommend ? "是" : "否"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="sort_id" label="排序" width="width">
          </el-table-column>
          <el-table-column prop="prop" label="操作" width="width">
            <template>
              <el-button
                type="primary"
                size="small"
                @click="editServerZzDialog = true"
                >编辑</el-button
              >
              <el-button type="danger" size="small" @click="delBtnAdded"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <el-button
          type="primary"
          style="margin-top: 20px"
          size="mini"
          @click="addServerZzDialog = true"
          >添加</el-button
        >
      </el-tab-pane>
      <el-tab-pane label="职聊增值包">
        <el-table :data="listAddedDuty" style="width: 100%">
          <el-table-column prop="name" label="名称" width="width">
          </el-table-column>
          <el-table-column prop="times" label="职聊次数" width="width">
            <template slot-scope="scope"> {{ scope.row.times }}点 </template>
          </el-table-column>
          <el-table-column prop="prop" label="服务价格" width="width">
            <template slot-scope="scope"> ￥ {{ scope.row.expense }} </template>
          </el-table-column>
          <el-table-column prop="prop" label="积分抵扣" width="width">
            <template>允许全额兑换</template>
          </el-table-column>
          <el-table-column prop="prop" label="显示状态" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.is_display ? 'success' : 'danger'">{{
                scope.row.is_display ? "显示" : "隐藏"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="prop" label="推荐" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.recommend ? 'success' : 'danger'">{{
                scope.row.recommend ? "是" : "否"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="sort_id" label="排序" width="width">
          </el-table-column>
          <el-table-column prop="prop" label="操作" width="width">
            <template>
              <el-button type="primary" size="small" @click="editServerZlZzDialog=true">编辑</el-button>
              <el-button type="danger" size="small" @click="delBtnZlAdded"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <el-button type="primary" style="margin-top: 20px" size="mini" @click="addServerZlZzDialog=true"
          >添加</el-button
        >
      </el-tab-pane>
    </el-tabs>
    <addServer :addServerDialog.sync="addServerDialog" />
    <editServer :editServerDialog.sync="editServerDialog" />

    <addJjServer :addServerJjDialog.sync="addServerJjDialog" />
    <editJjServer :editServerJjDialog.sync="editServerJjDialog" />

    <addZnServer :addServerZnDialog.sync="addServerZnDialog" />
    <editZnServer :editServerZnDialog.sync="editServerZnDialog" />

    <addZzServer :addServerZzDialog.sync="addServerZzDialog" />
    <editZzServer :editServerZzDialog.sync="editServerZzDialog" />

    <addZlZzServer :addServerZlZzDialog.sync="addServerZlZzDialog" />
    <editZlZzServer :editServerZlZzDialog.sync="editServerZlZzDialog" />
  </div>
</template>

<script>
import addServer from "@/views/platformSystem/qyBusinessConfig/addedServe/components/addServer";
import editServer from "@/views/platformSystem/qyBusinessConfig/addedServe/components/editServer";

import addJjServer from "@/views/platformSystem/qyBusinessConfig/addedServe/components/addJjServer";
import editJjServer from "@/views/platformSystem/qyBusinessConfig/addedServe/components/editJjServer";

import addZnServer from "@/views/platformSystem/qyBusinessConfig/addedServe/components/addZnServer";
import editZnServer from "@/views/platformSystem/qyBusinessConfig/addedServe/components/editZnServer";

import addZzServer from "@/views/platformSystem/qyBusinessConfig/addedServe/components/addZzServer";
import editZzServer from "@/views/platformSystem/qyBusinessConfig/addedServe/components/editZzServer";

import addZlZzServer from "@/views/platformSystem/qyBusinessConfig/addedServe/components/addZlZzServer";
import editZlZzServer from "@/views/platformSystem/qyBusinessConfig/addedServe/components/editZlZzServer";
export default {
  components: {
    addServer,
    addJjServer,
    addZnServer,
    addZzServer,
    addZlZzServer,
    editServer,
    editJjServer,
    editZnServer,
    editZzServer,
    editZlZzServer,
  },
  data() {
    return {
      addServerDialog: false,
      editServerDialog: false,

      addServerJjDialog: false,
      editServerJjDialog: false,

      addServerZnDialog: false,
      editServerZnDialog: false,

      addServerZzDialog: false,
      editServerZzDialog: false,

      addServerZlZzDialog: false,
      editServerZlZzDialog: false,
      listTop: [
        {
          id: 1,
          name: "职位置顶3天",
          recommend: 0,
          days: 3,
          expense: "1.00",
          enable_points_deduct: 1,
          deduct_max: "0.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 2,
          name: "职位置顶7天",
          recommend: 0,
          days: 7,
          expense: "3.00",
          enable_points_deduct: 1,
          deduct_max: "0.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 3,
          name: "职位置顶30天",
          recommend: 0,
          days: 30,
          expense: "10.00",
          enable_points_deduct: 1,
          deduct_max: "10.00",
          is_display: 0,
          sort_id: 0,
        },
      ],
      listEmergency: [
        {
          id: 1,
          name: "职位紧急30天",
          recommend: 0,
          days: 30,
          expense: "10.00",
          enable_points_deduct: 1,
          deduct_max: "10.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 2,
          name: "职位紧急7天",
          recommend: 0,
          days: 7,
          expense: "3.00",
          enable_points_deduct: 1,
          deduct_max: "0.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 3,
          name: "职位紧急3天(免费)",
          recommend: 0,
          days: 3,
          expense: "1.00",
          enable_points_deduct: 1,
          deduct_max: "0.00",
          is_display: 0,
          sort_id: 99,
        },
      ],
      listRefresh: [
        {
          id: 1,
          name: "刷新3次",
          recommend: 0,
          times: 3,
          expense: "1.00",
          enable_points_deduct: 1,
          deduct_max: "0.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 2,
          name: "刷新6次",
          recommend: 0,
          times: 6,
          expense: "1.00",
          enable_points_deduct: 1,
          deduct_max: "15.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 3,
          name: "刷新10次",
          recommend: 0,
          times: 10,
          expense: "2.00",
          enable_points_deduct: 1,
          deduct_max: "5.00",
          is_display: 0,
          sort_id: 0,
        },
      ],
      listAdded: [
        {
          id: 1,
          name: "简历下载点100点",
          recommend: 0,
          download_resume_point: 100,
          expense: "10.00",
          enable_points_deduct: 1,
          deduct_max: "0.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 2,
          name: "简历下载点200点",
          recommend: 0,
          download_resume_point: 200,
          expense: "15.00",
          enable_points_deduct: 1,
          deduct_max: "10.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 3,
          name: "简历下载点300点",
          recommend: 0,
          download_resume_point: 300,
          expense: "20.00",
          enable_points_deduct: 1,
          deduct_max: "15.00",
          is_display: 0,
          sort_id: 0,
        },
      ],
      listAddedDuty: [
        {
          id: 1,
          name: "职聊10次",
          recommend: 0,
          times: 10,
          expense: "2.00",
          enable_points_deduct: 1,
          deduct_max: "0.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 2,
          name: "职聊50次",
          recommend: 0,
          times: 50,
          expense: "12.00",
          enable_points_deduct: 1,
          deduct_max: "5.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 3,
          name: "职聊100次",
          recommend: 0,
          times: 100,
          expense: "23.00",
          enable_points_deduct: 1,
          deduct_max: "10.00",
          is_display: 0,
          sort_id: 0,
        },
      ],
    };
  },
  methods: {
    // 职位置顶
    delBtnTop() {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    // 职位紧急
    delBtnEmergency() {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    // 职位智能刷新
    delBtnRefresh() {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    // 简历增值包
    delBtnAdded() {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    // 职聊增值包
    delBtnZlAdded() {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
  },
};
</script>

<style lang="scss" scoped></style>
